{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "def load_data_and_labels(path):\n",
    "    data = []\n",
    "    lines = [line.strip() for line in open(path)]\n",
    "    max_sentence_length = 0\n",
    "    for idx in range(0, len(lines), 4):\n",
    "        sentence = lines[idx].split(\"\\t\")[1][1:-1]\n",
    "        relation = lines[idx + 1]\n",
    "        data.append([relation, sentence])\n",
    "    return data\n",
    "        \n",
    "data = load_data_and_labels('./SemEval2010_task8_all_data/SemEval2010_task8_testing_keys/TEST_FILE_FULL.TXT')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('./data/raw-valid-data.tsv', 'w+') as f:\n",
    "    for rel, sent in data:\n",
    "        f.write(rel + '\\t' + sent + '\\n')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
